#include "setting.h"
#include "default_logger.h"
#include "log.h"
#include "log_manager.h"
#include <string>
#include <memory>
namespace lib_wrapper {
#ifdef USE_SPDLOGGER
#include "spdlog_logger.h"
#endif

#ifdef USE_CUSTOMLOGGER
#include "example.h"
#endif

void set_logger(LogLevel level_type) {
  std::string level;
  switch (level_type) {
  case LogLevel::Trace:
    level = "trace";
    break;
  case LogLevel::Debug:
    level = "debug";
    break;
  case LogLevel::Info:
    level = "info";
    break;
  case LogLevel::Warn:
    level = "warn";
    break;
  case LogLevel::Error:
    level = "error";
    break;
  case LogLevel::Critical:
    level = "critical";
    break;
  default:
    level = "info";
  }

#ifdef USE_SPDLOGGER
  set_logger(std::make_shared<SpdLogger>("./log/splog.txt"));
#elif defined(USE_CUSTOMLOGGER)
  set_logger(std::make_shared<CustomLogger>());
#else
  set_logger(std::make_shared<DefaultLogger>("./log/splog.txt"));
#endif

  ilog->set_level(level);
}
} // namespace lib_wrapper
